# -*- conding:UTF-8 -*-

'''
@ Project: one-group
@ File: login_util.py
@ Author: 孙博
@ Date：2022/6/9 19:52

'''
from flask import g
from functools import wraps


# def login_required(func):
#     @wraps(func)
#     def wrapper(*args, **kwargs):
#         if g.user_id:
#             return func(*args, **kwargs)
#         else:
#             return {'message': '请先登录'}, 401
#
#     return wrapper


def login_required(func):
    @wraps(func)
    def warpper(*args, **kwargs):
        if g.user_id:
            return func(*args, **kwargs)
        else:
            return {'message': '请先登录'}, 401

    return warpper
